package com.xr.miniprogram.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xr.miniprogram.mapper.MiniProgramAgreementMapper;
import com.xr.miniprogram.domain.MiniProgramAgreement;
import com.xr.miniprogram.service.IMiniProgramAgreementService;

/**
 * 协议Service业务层处理
 * 
 * @author wls
 * @date 2023-12-15
 */
@Service
public class MiniProgramAgreementServiceImpl extends ServiceImpl<MiniProgramAgreementMapper, MiniProgramAgreement> implements IMiniProgramAgreementService
{
    @Autowired
    private MiniProgramAgreementMapper miniProgramAgreementMapper;

    /**
     * 查询协议
     * 
     * @param agreementId 协议主键
     * @return 协议
     */
    @Override
    public MiniProgramAgreement selectAgreementById(Long agreementId)
    {
        return miniProgramAgreementMapper.selectById(agreementId);
    }

    /**
     * 查询协议列表
     * 
     * @param miniProgramAgreement 协议
     * @return 协议
     */
    @Override
    public List<MiniProgramAgreement> selectAgreementList(MiniProgramAgreement miniProgramAgreement)
    {
        return miniProgramAgreementMapper.selectAgreementList(miniProgramAgreement);
    }

    /**
     * 新增协议
     * 
     * @param miniProgramAgreement 协议
     * @return 结果
     */
    @Override
    public int insertAgreement(MiniProgramAgreement miniProgramAgreement)
    {
        return miniProgramAgreementMapper.insert(miniProgramAgreement);
    }

    /**
     * 修改协议
     * 
     * @param miniProgramAgreement 协议
     * @return 结果
     */
    @Override
    public int updateAgreement(MiniProgramAgreement miniProgramAgreement)
    {
        return miniProgramAgreementMapper.updateById(miniProgramAgreement);
    }

    /**
     * 批量删除协议
     * 
     * @param agreementIds 需要删除的协议主键
     * @return 结果
     */
    @Override
    public int deleteAgreementByAgreementIds(Long[] agreementIds)
    {
        return miniProgramAgreementMapper.deleteBatchIds(Arrays.asList(agreementIds));
    }

    /**
     * 删除协议信息
     * 
     * @param agreementId 协议主键
     * @return 结果
     */
    @Override
    public int deleteAgreementByAgreementId(Long agreementId)
    {
        return miniProgramAgreementMapper.deleteById(agreementId);
    }
}
